<?php
class CONTROL {

    function __construct() {
        $this->router();
    }

    function router(){
        if (isset($_POST['func'])) {
            $ajax = new AJAX();
            $ajax->$_POST['func']();
        } else {
            $layouts = array('list','book','store','about');
            foreach ($layouts as $item)
                isset($_GET[$item])?$layout=$item:'';
            !isset($layout)?$layout='index':'';
            $this->site($layout);
        }
    }

    function site($layout) {
        $pdf = new SITE($layout);
        import('src.header');
        import('src.layout.'.$layout);
        import('src.footer');
    }
}
